home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / src / CdBS_KQSrc0_3.lha / KaliosysQuantrum / Main.s < prev    next >
Text File  |  1997-11-06  |  12KB  |  510 lines

  1. *
  2. * CdBSian Obviously Universal & Interactive Nonsense (COUIN)
  3. * (Absurdité CdBSienne Manifestement Universelle et Interactive)
  4. * ©1997, CdBS Software (MORB)
  5. * Main routine
  6. * $Id: Main.s 0.8 1997/09/27 22:50:21 MORB Exp MORB $
  7. *
  8.  
  9. _Main:
  10.          movem.l   d0-7/a0-6,-(a7)
  11.  
  12.          move.l    a7,_A7Save
  13.          move.l    #_GameCopTable,_CopperTable
  14.          bsr       _InitBlitNodes
  15.          clr.w     _Debug
  16.  
  17.          bsr       _InitGui
  18.  
  19.          lea       Plf1(pc),a5
  20.          lea       BpPtrs+2,a1
  21.          lea       WBpPtrs+2,a2
  22.          move.l    a1,pf_BpPtrs(a5)
  23.          move.l    a2,pf_BpWPtrs(a5)
  24.          move.l    #Wrap,pf_WPosPtr(a5)
  25.  
  26.          lea       Plf2(pc),a5
  27.          lea       BpPtrs2+2,a1
  28.          lea       WBpPtrs2+2,a2
  29.          move.l    a1,pf_BpPtrs(a5)
  30.          move.l    a2,pf_BpWPtrs(a5)
  31.          move.l    #Wrap2,pf_WPosPtr(a5)
  32.  
  33.          lea       BpPtrs,a1
  34.          lea       WBpPtrs,a2
  35.          move.w    #bplpt,d0
  36.          moveq     #NbPlanes-1,d1
  37. .FillClst_Loop:
  38.          swap      d2
  39.          move.w    d0,(a1)+
  40.          move.w    d0,(a2)+
  41.          move.w    d2,(a1)+
  42.          move.w    d2,(a2)+
  43.          addq.w    #2,d0
  44.          move.w    d0,(a1)+
  45.          move.w    d0,(a2)+
  46.          swap      d2
  47.          move.w    d2,(a1)+
  48.          move.w    d2,(a2)+
  49.          addq.w    #6,d0
  50.          add.l     #BufferWidth,d2
  51.          dbf       d1,.FillClst_Loop
  52.  
  53.          lea       BpPtrs2,a1
  54.          lea       WBpPtrs2,a2
  55.          move.w    #bplpt+4,d0
  56.          moveq     #NbPlanes-1,d1
  57. .FillClst_Loop2:
  58.          swap      d2
  59.          move.w    d0,(a1)+
  60.          move.w    d0,(a2)+
  61.          move.w    d2,(a1)+
  62.          move.w    d2,(a2)+
  63.          addq.w    #2,d0
  64.          move.w    d0,(a1)+
  65.          move.w    d0,(a2)+
  66.          swap      d2
  67.          move.w    d2,(a1)+
  68.          move.w    d2,(a2)+
  69.          addq.w    #6,d0
  70.          add.l     #BufferWidth,d2
  71.          dbf       d1,.FillClst_Loop2
  72.  
  73.          move.l    #_MouseGardenDwarfDat,_GDwarfTable
  74.  
  75.          ;lea       _GDwarfTable+2*4,a3
  76.          ;moveq     #5-1,d5
  77.          ;lea       _BackDats,a4
  78.          ;lea       BGDwarves,a0
  79.          ;moveq     #32,d7    ; 67
  80.          ;moveq     #0,d6
  81.  
  82. .BgLoop:
  83.          ;move.l    a4,(a3)+
  84.          ;move.l    a4,(a0)
  85.          ;move.w    d6,gdw_X(a0)
  86.          ;move.w    d7,gdw_Y(a0)
  87.          ;bsr       _RefreshGardenDwarf
  88.          ;lea       2*16+122*16(a4),a4
  89.          ;lea       gdw_Size(a0),a0
  90.          ;add.l     #64*4,d6
  91.          ;dbf       d5,.BgLoop
  92.  
  93.          ;bsr       _LoadGardenDwarvesPtrs
  94.  
  95.  
  96.          moveq     #100,d0
  97.          bsr       _BackGroundScroll
  98.  
  99.          bsr       _Ripolin
  100.  
  101.          lea       Plf1(pc),a5
  102.          move.l    #RTbl1,pf_RefreshTbls(a5)
  103.          move.l    #RTbl1,pf_RefreshPtrs(a5)
  104.          move.l    #RTbl2,pf_RefreshTbls+4(a5)
  105.          move.l    #RTbl2,pf_RefreshPtrs+4(a5)
  106.          move.l    #RTbl3,pf_RefreshTbls+8(a5)
  107.          move.l    #RTbl3,pf_RefreshPtrs+8(a5)
  108.          bsr       _ScrlInit
  109.          lea       Plf2(pc),a5
  110.  
  111.          movem.l   X,d0-1
  112.          lsr.l     #1,d0
  113.          lsr.l     #1,d1
  114.          movem.l   d0-1,X2
  115.  
  116.          bsr       _ScrlInit
  117.  
  118.          move.l    #-1,RTbl1
  119.          move.l    #-1,RTbl2
  120.          move.l    #-1,RTbl3
  121.  
  122.          movem.l   d0-7/a0-6,-(a7)
  123.          bsr       _MergeCopperLists
  124.          movem.l   (a7)+,d0-7/a0-6
  125.  
  126.          lea       CustomBase,a6
  127.          move.l    #CopperList,cop1lc(a6)
  128.          clr.w     copjmp1(a6)
  129.  
  130.          bsr       _SwitchToCOUIN
  131.  
  132.          ;move.w    #1,fmode(a6)
  133.  
  134.          move.l    #TstScrl,_VblHook
  135.          bsr       _WaitVbl
  136.  
  137.          move.w    #DMAF_SETCLR|DMAF_MASTER|DMAF_RASTER|DMAF_COPPER|DMAF_BLITTER|DMAF_SPRITE,dmacon(a6)
  138.  
  139.          bsr       _DebugMenu
  140.  
  141.  
  142.  
  143.          ;move.w    #$20,$dff09a
  144.  
  145.          ;moveq     #7,d2
  146.          ;sf        d1
  147.          ;move.l    _DispBitmap,d3
  148.          ;add.l     #4,d3
  149.          ;moveq     #0,d0
  150.          ;sub.l     a0,a0
  151.          ;lea       Plf1(pc),a5
  152.          ;bsr       _DrawTile
  153.          ;moveq     #8,d2
  154.          ;sf        d1
  155.          ;move.l    _DispBitmap,d3
  156.          ;add.l     #6,d3
  157.          ;moveq     #0,d0
  158.          ;sub.l     a0,a0
  159.          ;lea       Plf1(pc),a5
  160.          ;bsr       _DrawTile
  161.  
  162.  
  163. .BigLoop:
  164.          bsr.s     _WaitVbl
  165.          clr.l     _LastPlayfieldBlit
  166.  
  167.          lea       Plf1(pc),a5
  168.          move.l    pf_Sprites(a5),a4
  169.          move.l    sh_PosOfst(a4),d0
  170.          bchg      #4,d0
  171.          ;move.l    d0,sh_PosOfst(a4)
  172.  
  173.          bset      #1,_BlitDone
  174.          move.b    _UseCPU,_CpuGnaFlag
  175.          bsr       _RefreshBuffer
  176.          bsr       _DrawSpriteList
  177.  
  178.          ;cmp.l     #CopEnd,_GuiLayerPtr
  179.          ;beq.s     .NoGui
  180.          ;bsr       _CheckBlitLists
  181.          bsr.s     _HandleGui
  182.          ;bsr       _CheckBlitLists
  183. ;.NoGui:
  184.  
  185.          bclr      #1,_BlitDone
  186.  
  187.          ;bclr      #0,_BlitDone
  188.          ;beq.s     .GnaBlitter
  189.          ;sf        _UseCPU
  190.          ;move.l    pf_BlitWorkOfst(a5),pf_WorkOfst(a5)
  191. .GnaBlitter:
  192.  
  193.          lea       Plf1(pc),a5
  194.          st        _UseCPU
  195.          move.l    pf_CpuWorkOfst(a5),pf_WorkOfst(a5)
  196.  
  197.          move.w    #$0040,intena(a6)
  198.          move.w    #$2700,sr
  199.          ;bsr       _CheckBlitLists
  200.          move.l    _LastPlayfieldBlit,a0
  201.          move.l    a0,d0
  202.          beq.s     .DoCBuf
  203.          cmp.l     #1,-4(a0)
  204.          bne.s     .DoCBuf
  205.  
  206.          move.l    #2,-4(a0)
  207.          bra.s     .BlitOk
  208.  
  209. .DoCBuf:
  210.          bclr      #0,_BlitDone
  211.          ;bsr       _CheckBlitLists
  212.          bsr       _ChangeBuffers
  213.          sf        _UseCPU
  214.          move.l    pf_BlitWorkOfst(a5),pf_WorkOfst(a5)
  215.          move.w    #$2000,sr
  216.          move.w    #$8040,intena(a6)
  217.          bra.s     .BigLoop
  218.  
  219. .BlitOk:
  220.          move.w    #$2000,sr
  221.          move.w    #$8040,intena(a6)
  222.  
  223.          tst.b     _CpuGnaFlag
  224.          bne.s     .GnaCpu
  225.  
  226. .gleurp:
  227.          tst.b     _UseCPU
  228.          bne.s     .gleurp
  229.          bra       .BigLoop
  230.  
  231. .GnaCpu:
  232.          bsr       _DoCPUBlits           
  233.          ;move.w    #$ff0,$dff180
  234.          tst.b     d0                    
  235.          beq       .BigLoop
  236.                                          
  237. .gagu:                                   
  238.          ;move.w    $dff006,d0
  239.          ;and.w     #$f0f,d0
  240.          ;move.w    d0,$dff180
  241.          ;btst      #6,$dff016
  242.          ;bne.s     .gagu
  243. .gneee:                                  
  244.          ;btst      #6,$dff016
  245.          ;beq.s     .gneee
  246.                                          
  247. .WaitForBlitter:                         
  248.          ;move.w    $dff006,d0
  249.          ;and.w     #$ff0,d0
  250.          ;move.w    d0,$dff180
  251.          tst.b     _UseCPU
  252.          bne.s     .WaitForBlitter
  253.  
  254.          bsr       _WaitVbl
  255.          lea       Plf1(pc),a5
  256.          bsr       _ChangeBuffers
  257.          sf        _UseCPU
  258.          move.l    pf_BlitWorkOfst(a5),pf_WorkOfst(a5)
  259.  
  260.          bra       .BigLoop
  261.  
  262. _CBufHook:
  263.          lea       Plf1(pc),a5
  264.          bsr       _ChangeBuffers
  265.          bset      #0,_BlitDone
  266.          btst      #1,_BlitDone
  267.          bne.s     .Ouin
  268.  
  269.          sf        _UseCPU
  270.          move.l    pf_BlitWorkOfst(a5),pf_WorkOfst(a5)
  271.  
  272. .Ouin:
  273.          rts
  274.  
  275. _CpuGnaFlag:
  276.          ds.b      1
  277. _BlitDone:
  278.          ds.b      1
  279.          even
  280.  
  281. _Exit:
  282.          bsr       _SwitchToSystem
  283.          movem.l   (a7)+,d0-7/a0-6
  284.          rts
  285.  
  286.  
  287. TstScrl:
  288.          move.l    Low_Base,a6
  289.  
  290.          bsr       _HandleMouse
  291.          movem.l   XSpeed,d6-7
  292.  
  293.          moveq     #1,d0
  294.          CALL      ReadJoyPort
  295.          btst      #JPB_JOY_LEFT,d0
  296.          beq.s     .NoLeft
  297.          sub.l     d6,X
  298. .NoLeft:
  299.          btst      #JPB_JOY_RIGHT,d0
  300.          beq.s     .NoRight
  301.          add.l     d6,X
  302. .NoRight:
  303.          btst      #JPB_JOY_UP,d0
  304.          beq.s     .NoUp
  305.          sub.l     d7,Y
  306. .NoUp:
  307.          btst      #JPB_JOY_DOWN,d0
  308.          beq.s     .NoDown
  309.          add.l     d7,Y
  310. .NoDown:
  311.  
  312.          lea       Plf1(pc),a5
  313.          bsr       _HardwareScrolling
  314.          move.l    d0,-(a7)
  315.  
  316.          movem.l   X,d0-1
  317.          lsr.l     #1,d0
  318.          lsr.l     #1,d1
  319.          ;sub.l     #150,d1
  320.          movem.l   d0-1,X2
  321.          lsr.l     #1,d0
  322.          bsr       _BackGroundScroll
  323.  
  324.          lea       Plf2(pc),a5
  325.          bsr       _HardwareScrolling
  326.  
  327.          move.l    (a7)+,d1
  328.          lsr.w     #4,d1
  329.          or.w      d1,d0
  330.          move.w    d0,_BplCon1
  331.  
  332.          bsr       _MergeCopperLists
  333.  
  334.          lea       Plf1(pc),a5
  335.          bsr       _GerflorScrolling
  336.          lea       Plf2(pc),a5
  337.          bsr       _GerflorScrolling
  338.          rts
  339. gna:
  340.  
  341.          move.l    Low_Base,a6
  342.  
  343.          bsr       _HandleMouse
  344.  
  345.          moveq     #1,d0
  346.          CALL      ReadJoyPort
  347.          btst      #JPB_JOY_LEFT,d0
  348.          beq.s     .NoLeft
  349.          sub.l     #4,X
  350. .NoLeft:
  351.          btst      #JPB_JOY_RIGHT,d0
  352.          beq.s     .NoRight
  353.          add.l     #4,X
  354. .NoRight:
  355.          btst      #JPB_JOY_UP,d0
  356.          beq.s     .NoUp
  357.          sub.l     #2,Y
  358. .NoUp:
  359.          btst      #JPB_JOY_DOWN,d0
  360.          beq.s     .NoDown
  361.          add.l     #2,Y
  362. .NoDown
  363.  
  364.          lea       Plf1(pc),a5
  365.          bsr       _HardwareScrolling
  366.          bsr       _MergeCopperLists
  367.          lea       Plf1(pc),a5
  368.          bsr       _GerflorScrolling
  369.          rts
  370.  
  371. _LastPlayfieldBlit:
  372.          ds.l      1
  373.  
  374. _GameCopTable:
  375.          dc.l      GameNml
  376.          dc.l      CopLayer1,CopLayer3,CopLayer2000
  377. _GuiLayerPtr:
  378.          dc.l      CopEnd,-1
  379.          ;dc.l      CopLayer4,-1
  380. CopLayer1:
  381.          dc.l      0,0
  382.          dc.w      $29,CET_LONG
  383.          dc.l      RipolinBuf
  384.          dc.l      LST_BLOCK
  385.          dc.l      (16+4+3)*4
  386. cl12:
  387.          dc.l      0,0
  388.          dc.w      $30,CET_LONG
  389.          dc.l      cl12buf
  390.          dc.l      LST_NOMANSLAND
  391.  
  392. CopLayer2:
  393.          dc.l      0,0
  394.          dc.w      $110,CET_SHORT
  395.          dc.l      cl21dat
  396.  
  397. CopLayer3:
  398.          dc.l      0,0
  399. Wrap:
  400.          dc.w      $40,CET_LATE
  401.          dc.l      WrapDat
  402.  
  403. CopLayer2000:
  404.          dc.l      0,0
  405. Wrap2:
  406.          dc.w      $40,CET_LATE
  407.          dc.l      WrapDat2
  408.  
  409. BGDwarves:
  410.          rept      5
  411.  
  412.          dc.l      0,0
  413.          dc.w      0,0,122
  414.  
  415.          endr
  416.  
  417. Plf1SprH:
  418.          dc.l      0
  419.          dc.l      Plf1
  420.          dc.l      0
  421.  
  422. Plf2SprH:
  423.          dc.l      0
  424.          dc.l      Plf2
  425.          dc.l      0
  426.  
  427. Plf1:
  428.          dc.l      Plf1Tiles
  429.          dc.l      Plf1SprH
  430.  
  431.          dc.l      Plf1Map+12
  432.  
  433.          dc.l      0         ;TstMap-45*4-4
  434.          dc.l      0         ;TstMap-45*4-4
  435.  
  436.          dc.l      100,100
  437.          dc.l      0,0       ;1728,5184
  438.  
  439. X:
  440.          dc.l      400*4
  441. Y:
  442.          dc.l      5000      ;BufferHeight*3+150+30
  443.          dc.l      0,0
  444.          dc.l      0,0,0,0
  445.  
  446.          dc.l      0,0,0,0
  447.          dc.l      0,0,0
  448.          dc.l      0,0,0,0
  449.          dc.l      4,0,4,8
  450. _Bitmap1:
  451.          ds.l      1
  452. _Bitmap2:
  453.          ds.l      1
  454. _Bitmap3:
  455.          ds.l      1
  456.  
  457. _ClearBitmap:
  458.          dc.l      0
  459.          dc.l      0,0,0,0,0,0
  460.  
  461.          dc.w      0
  462.          dc.w      0,0,0,0   ;-1,-1,-1,-1
  463.          ds.l      30
  464.  
  465. Plf2:
  466.          dc.l      Plf2Tiles
  467.          dc.l      Plf2SprH
  468.  
  469.          dc.l      Plf2Map+12
  470.  
  471.          dc.l      0         ;TstMap-45*4-4
  472.          dc.l      0         ;TstMap-45*4-4
  473.  
  474.          dc.l      61,58
  475.          dc.l      0,0       ;1728,5184
  476.  
  477. X2:
  478.          dc.l      400*4
  479. ;Y:
  480.          dc.l      BufferHeight*3+150+30
  481.          dc.l      0,0
  482.          dc.l      0,0,0,0
  483.  
  484.          dc.l      0,0,0,0
  485.          dc.l      0,0,0
  486.          dc.l      0,0,0,0
  487.          dc.l      4,0,4,8
  488. _Bitmap4:
  489.          ds.l      1
  490. _Bitmap5:
  491.          ds.l      1
  492. _Bitmap6:
  493.          ds.l      1
  494.  
  495. _ClearBitmap2:
  496.          dc.l      0
  497.          dc.l      0,0,0,0,0,0
  498.  
  499.          dc.w      0
  500.          dc.w      0,0,0,0   ;-1,-1,-1,-1
  501.          ds.l      30
  502.  
  503. Plf1Map:
  504.          incbin    "test.map"
  505.          even
  506. Plf2Map:
  507.          incbin    "test2.map"
  508.          even
  509.  
  510.